﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrimaryAlgorithm.HammingDistance
{
    class MainProject
    {
        static void Main(string[] args)
        {
            Console.WriteLine(HammingDistance(1, 4));
            Console.ReadKey();
        }
        public static int HammingDistance(int x, int y)
        {
            int n = 3 | 1;
            //右移
            int count = 0;
            for (int i = 0; i < 32; i++)
            {
                if ((n & 1) == 1)
                {
                    count++;
                }
                n = n >> 1;
            }
            return count;
        }
    }
}
